#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
char s[110];
int main()
{
	while(scanf("%s",s)!=EOF)
	{
		int ans = 10000;
		int numn=0;
		int numi=0;
		int nume=0;
		int numt=0;
		int len = strlen(s);
		for(int i = 0;i<len;i++)
		{
			if(s[i]=='n') numn++;
			else if(s[i]=='i') numi++;
			else if(s[i]=='e') nume++;
			else if(s[i]=='t') numt++;
		}
		//printf("%d\n",numn);
		if(numn==2) ans = 0;
		numn = (numn-3)/2+1;
		nume = nume/3;
		ans = min(ans,numn);
		ans = min(ans,numi);
		ans = min(ans,nume);
		ans = min(ans,numt);
		printf("%d\n",ans);
	}
}

